package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@MappedSuperclass
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class BaseEntity extends BaseDataEntity {

	protected Tenant tenant;// 对应租户

	@JsonApiToOne
	// @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "tenant_id", foreignKey = @ForeignKey(name = "null"))
	public Tenant getTenant() {
		return tenant;
	}

	public void setTenant(Tenant tenant) {
		this.tenant = tenant;
	}
}
